<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查找 HTML 元素</title>
</head>
<body>
<h2>通过 CSS 选择器查找 HTML 元素</h2>
<p class="intro">DOM</p>
<p class="intro">querySelectorAll</p>

<p id="demo"></p>

<script>
  var x = document.querySelectorAll("p.intro");
  document.getElementById("demo").innerHTML =
  'class ="intro" 的第一段（索引 0）：' + x[0].innerHTML;
</script>
</body>
</html>